package org.example.demosystem.service.Impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.example.demosystem.entity.Student;
import org.example.demosystem.mapper.StudentMapper;
import org.example.demosystem.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper StudentMapper;

    /**
     * 分页查询全部学生信息
     */
    public Page<Student> getStudentsByPage(int pageNum, int pageSize, String name) {
        Page<Student> page = new Page<>(pageNum, pageSize);
        return StudentMapper.selectPage(page, name);
    }

    @Override
    public void removeById(int sno) {
        StudentMapper.deleteById(sno);
    }

    @Override
    public void save(Student student) {
        StudentMapper.save(student);
    }


}
